/*
 * @Author: wjc
 * @Date: 2023-05-18 17:20:22
 * @LastEditors: wjc
 * @LastEditTime: 2025-10-29 14:49:43
 * @Description: 静态解析图标，以支持 unocss 动态图标，在 uno.config.ts 中的 safelist 使用
 */
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

import ep from '@iconify-json/ep/icons.json'

const epIconList = Object.keys(ep.icons).map((i) => `i-ep-${i}`)

// 自定义图标的预加载
const entry = fs.readdirSync(
  path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../assets/icons/')
)
const customIcons = entry.map((item: string) => `i-custom-${item.replace(/\.svg/, '')}`)

const iconList = [...epIconList, ...customIcons]

export default iconList
